package com.sino.tb.auditing.entity;

import java.util.*;
import java.sql.*;
import com.sino.tb.Power.*;
import xpubbean.Db.*;

public class ConfirmPower {
	private double freeValue1025;
	private double freeValue1026;
	private double freeValue1070;
	private double perMaxAmount1025;
	private double perMaxAmount1026;
	private double perMaxAmount1070;
	private double perMinAmount1025;
	private double perMinAmount1026;
	private double perMinAmount1070;
	private double sumValue1025;
	private double sumValue1026;
	private double sumValue1070;
	private double yearMaxAmount1025;
	private double yearMaxAmount1026;
	private double yearMaxAmount1070;

	public ConfirmPower(LoginInfo loginInfo, Connection conn) {
		String sql = "SELECT t1.*, nvl(t2.c_sum_value, 0) c_sum_value,  t1.c_year_max_amount - nvl(t2.c_sum_value, 0) c_free_value " +
					 "FROM ( SELECT * FROM   v_pub_confirm_power WHERE  c_org_id = " + loginInfo.getOrgID()+ ") t1, " +
					 "(select c_prj_seq,c_org_audit, c_sum c_sum_value from v_pub_confirm_stat WHERE  c_org_audit = " + loginInfo.getOrgID()+ " order by c_prj_seq ) t2 " +
					 "where t1.c_org_id = t2.c_org_audit(+) and t1.c_confirm_type = t2.c_prj_seq(+) ";

		ResultSetPlus rs = new ResultSetPlus(sql, conn);
		while (rs.next()) {
			switch (Integer.parseInt(rs.getFieldStr("c_confirm_type"))) {
				case 1025:
					this.setPerMaxAmount1025(Double.parseDouble(rs.getFieldStr("c_per_max_amount")));
					this.setPerMinAmount1025(Double.parseDouble(rs.getFieldStr("c_per_min_amount")));
					this.setYearMaxAmount1025(Double.parseDouble(rs.getFieldStr("c_year_max_amount")));
					this.setSumValue1025(Double.parseDouble(rs.getFieldStr("c_sum_value")));
					this.setFreeValue1025(Double.parseDouble(rs.getFieldStr("c_free_value")));
					break;
				case 1026:
					this.setPerMaxAmount1026(Double.parseDouble(rs.getFieldStr("c_per_max_amount")));
					this.setPerMinAmount1026(Double.parseDouble(rs.getFieldStr("c_per_min_amount")));
					this.setYearMaxAmount1026(Double.parseDouble(rs.getFieldStr("c_year_max_amount")));
					this.setSumValue1026(Double.parseDouble(rs.getFieldStr("c_sum_value")));
					this.setFreeValue1026(Double.parseDouble(rs.getFieldStr("c_free_value")));
					break;
				case 1070:
					this.setPerMaxAmount1070(Double.parseDouble(rs.getFieldStr("c_per_max_amount")));
					this.setPerMinAmount1070(Double.parseDouble(rs.getFieldStr("c_per_min_amount")));
					this.setYearMaxAmount1070(Double.parseDouble(rs.getFieldStr("c_year_max_amount")));
					this.setSumValue1070(Double.parseDouble(rs.getFieldStr("c_sum_value")));
					this.setFreeValue1070(Double.parseDouble(rs.getFieldStr("c_free_value")));
					break;
			}
		}
	}

	public double getFreeValue1025() {
		return freeValue1025;
	}

	public void setFreeValue1025(double freeValue1025) {
		this.freeValue1025 = freeValue1025;
	}

	public double getFreeValue1026() {
		return freeValue1026;
	}

	public void setFreeValue1026(double freeValue1026) {
		this.freeValue1026 = freeValue1026;
	}

	public double getFreeValue1070() {
		return freeValue1070;
	}

	public void setFreeValue1070(double freeValue1070) {
		this.freeValue1070 = freeValue1070;
	}

	public double getPerMaxAmount1025() {
		return perMaxAmount1025;
	}

	public void setPerMaxAmount1025(double perMaxAmount1025) {
		this.perMaxAmount1025 = perMaxAmount1025;
	}

	public double getPerMaxAmount1026() {
		return perMaxAmount1026;
	}

	public void setPerMaxAmount1026(double perMaxAmount1026) {
		this.perMaxAmount1026 = perMaxAmount1026;
	}

	public double getPerMaxAmount1070() {
		return perMaxAmount1070;
	}

	public void setPerMaxAmount1070(double perMaxAmount1070) {
		this.perMaxAmount1070 = perMaxAmount1070;
	}

	public double getPerMinAmount1025() {
		return perMinAmount1025;
	}

	public void setPerMinAmount1025(double perMinAmount1025) {
		this.perMinAmount1025 = perMinAmount1025;
	}

	public double getPerMinAmount1026() {
		return perMinAmount1026;
	}

	public void setPerMinAmount1026(double perMinAmount1026) {
		this.perMinAmount1026 = perMinAmount1026;
	}

	public double getPerMinAmount1070() {
		return perMinAmount1070;
	}

	public void setPerMinAmount1070(double perMinAmount1070) {
		this.perMinAmount1070 = perMinAmount1070;
	}

	public double getSumValue1025() {
		return sumValue1025;
	}

	public void setSumValue1025(double sumValue1025) {
		this.sumValue1025 = sumValue1025;
	}

	public double getSumValue1026() {
		return sumValue1026;
	}

	public void setSumValue1026(double sumValue1026) {
		this.sumValue1026 = sumValue1026;
	}

	public double getSumValue1070() {
		return sumValue1070;
	}

	public void setSumValue1070(double sumValue1070) {
		this.sumValue1070 = sumValue1070;
	}

	public double getYearMaxAmount1025() {
		return yearMaxAmount1025;
	}

	public void setYearMaxAmount1025(double yearMaxAmount1025) {
		this.yearMaxAmount1025 = yearMaxAmount1025;
	}

	public double getYearMaxAmount1026() {
		return yearMaxAmount1026;
	}

	public void setYearMaxAmount1026(double yearMaxAmount1026) {
		this.yearMaxAmount1026 = yearMaxAmount1026;
	}

	public double getYearMaxAmount1070() {
		return yearMaxAmount1070;
	}

	public void setYearMaxAmount1070(double yearMaxAmount1070) {
		this.yearMaxAmount1070 = yearMaxAmount1070;
	}
}
